<template>
  <MyModal ref="myModal" title="开通IM权限" :top="35" :width="740">
    <template #content>
      <a-alert
        type="warning"  
        description="请确认您已开通鱼小铺，登录客户端遇到下方提示"
        show-icon
        style="margin-bottom: 5px"
      />

      <div class="box">
        <img :src="IMAuthorizationPng" alt="获取图片失败..." />
      </div>

      <div style="margin-top: 10px; color: rgba(200, 200, 200);">
        本服务基于深圳市闲管家科技有限公司旗下产品闲管家授权功能实现，如有侵权请联系删除！
      </div>

      <div style="text-align: right;">
        <a-button type="primary" style="margin-right: 6px" @click="goAuthorization">
          前往授权
        </a-button>
      </div>
    </template>
  </MyModal>
</template>

<script setup lang="ts">
import axios from 'axios'
import { ref } from 'vue'
import IMAuthorizationPng from '@/assets/IMAuthorization.png'

const myModal = ref()

const showModal = () => {
  myModal.value?.showModal()
}

const emit = defineEmits<{
  refresh: []
}>()

defineExpose({
  showModal,
})

const goAuthorization = () => {
  axios({
    baseURL: 'http://101.35.196.129:6734/getUrl',
    method: 'get',
  }).then(res => {
    // console.log('res=', res)
    window.open(res.data.data.url)
  })
}
</script>

<style lang="less" scoped>
.box {
  width: 700px;
  height: 430px;
  padding: 5px;

  img {
    width: 100%;
    height: 100%;
  }
}
</style>
